const HEX_LIST: &'static [u8] = &[
    b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9', b'a', b'b', b'c', b'd', b'e', b'f',
];

pub fn byte_to_hex_str(buf: &[u8]) -> String {
    let mut s = Vec::with_capacity(buf.len() * 2);
    for v in buf {
        let n = *v as usize;
        s.push(HEX_LIST[n >> 4]);
        s.push(HEX_LIST[n & 0x0F])
    }
    unsafe { String::from_utf8_unchecked(s) }
}
